package com.example.xui_study;

import android.os.Bundle;
import android.view.View;

import com.example.xui_study.adapter.RecyclerViewBannerAdapter;
import com.xuexiang.xui.widget.banner.recycler.BannerLayout;
import com.xuexiang.xui.widget.toast.XToast;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;


public class BannerActivity extends BaseActivity implements BannerLayout.OnBannerItemClickListener {

    @BindView(R.id.bl_horizontal)
    BannerLayout blHorizontal;

    private RecyclerViewBannerAdapter mAdapterHorizontal;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_banner);

        ButterKnife.bind(this);

        blHorizontal.setAdapter(mAdapterHorizontal = new RecyclerViewBannerAdapter(DemoDataProvider.urls));

        mAdapterHorizontal.setOnBannerItemClickListener(this);

    }



    @Override
    public void onItemClick(int position) {
        XToast.success(BannerActivity.this, "点击了第" + (position + 1) + "个").show();
    }


    @OnClick({R.id.bt_back})
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.bt_back:
                onBackPressed();
                break;
            default:
                break;
        }
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
    }
}
